package com.block.common.constant;

import com.block.common.security.util.EncriptionKit;

/**
 * 
 * @date 2020/12/5 3:13 下午
 */
public class DBPassWordKeyConstant {
    /**
     * 生产解密公钥
     */
    private static final String PROD_PUBLIC_KEY="MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALy6kRnV2Ib6rD1cXbz/Jx4tyC6coGXD8DYji4Alh3dnZG6NAxrrR3EK2v+cilr+2dgn/iF1Qb6bjAEmSwe2mI0CAwEAAQ==";
    private static final String PROD_PRIVATE_KEY="MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAvLqRGdXYhvqsPVxdvP8nHi3ILpygZcPwNiOLgCWHd2dkbo0DGutHcQra/5yKWv7Z2Cf+IXVBvpuMASZLB7aYjQIDAQABAkEAgHksb37gUDpyZ67p7M9wjJ2zyO88TSpN6jzWKNzjU8b1bWNzLDRVBEfBhQnM6kmvx8rWAaYgQNurkLM+EahMQQIhAOrxiGBVgt32UVBA4svca6Kqf6I1YzQUi0kc6fisUZmdAiEAzaSy38skqM2WEzf9alkxVoj6aUoaLeVlt+u4Kmno/7ECIFNZULpsW7sG8Z35Bvyvu/e/aPxQ2FrXlvpfKZow99n5AiAt+n4X9Xab22OLpoAdkBWs8HF0qyHRUzH7/lMuAIIc8QIgIsgnYdp8yKWI96EshISKXdiq9hH0PxajPAGRCEM46Ls=";

    private  static final String DEV_PRIVATE_KEY="MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAOOlwdwjPfQQAl6In7R2sAt2OMPYJ9teSOWYnOPv5rErOO4vY8pa0UGJVmVODXLNS4nho1J5PgvG5i5lEc4tqhaeQoH4FtHFom08dHbHQiQbIECWBfYQ0KUoyj5rjLmL7d5BvNxbpYd2s+O84TzD3x1+g+RD5teowSEuoMOraBORAgMBAAECgYEAkbhGGsMYYkVpLtgn2t3qnLulZH/WK47z/LwvGZ00P46aV6VQLHTr5Bakjh5jb2xIgU9FO4LOm71LFMGvnxoN+E1tgHClAv1laj7VaEGe8mCRUSw7DofPByNiYVfQ440bpdB1A1wauBXQ2r60rbLGe1HKzV7vVHGuSm0phF0S2l0CQQDzeBzEx3NrihSq/Y1HQ6zggenTc+k2KP1eI8NXmNobTSZXaJcoHC1LNKXBFvtYc0V7T3EgO934gmg4Nuk5LK9fAkEA710upotQcsIj4QLHEG+BfXDx7vz4mFlxHKmvqSdi/Q3VzEawBbnEZYAUsQu5q36zEsJQ/fzWDoWeeb4fp9JTDwJAMKuJLLkmVJAU052+GUnpDDRMNu4L57zH8YK6sQ8oQp7olD6fQPBpCYirve7HLgZVFHJsDeKJ2/zNsrcfZkONhwJAPVdY7C9Jl48vGKvYjdq1iYsXRRKpNom9VgYaUTQZxxXzk10OIPmBXi2bn9+MXmmixIztqplP1friKPrTK/PXewJAGPfy4IdiIlQuexTUfdf1/Spoma56aOFLMqyGLjD40RodiBCMBi2ACmsTvAIqrtkTdRKULy8WXlJGPMDzcCRbzA==";
    /**
     * 测试环境公钥
     */
//    private static final String DEV_PUBLIC_KEY="MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAMTj/e0D4qWROaYzQQNRYdn5G1njzO/5bh5wKwZBgqgbhC2b0JY3kXuiAWeEYhk+raEQS5Q+lHZzLWpa7RRBh88CAwEAAQ==";

    private static final String DEV_PUBLIC_KEY="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDjpcHcIz30EAJeiJ+0drALdjjD2CfbXkjlmJzj7+axKzjuL2PKWtFBiVZlTg1yzUuJ4aNSeT4LxuYuZRHOLaoWnkKB+BbRxaJtPHR2x0IkGyBAlgX2ENClKMo+a4y5i+3eQbzcW6WHdrPjvOE8w98dfoPkQ+bXqMEhLqDDq2gTkQIDAQAB";

    private static final String TEST_PUBLIC_KEY = "";

    /**
     * 根据环境获取解密公钥
     * @param type
     * @return
     */
    public static String getPublickByProfile(String type){
        if("dev".equals(type)){
            return DEV_PUBLIC_KEY;
        }
        if("prod".equals(type)){
            return PROD_PUBLIC_KEY;
        }
        if("test".equals(type)){
            return TEST_PUBLIC_KEY;
        }
        return "";
    }

    public static void main(String[] args) {

        String pwds = EncriptionKit.passwordEncrypt(DEV_PRIVATE_KEY, "");
        System.out.println(pwds);
        /*String pwd = "NU+G2Vmb9adsN94Z8x9bNS5vDpKyBBRjjo6FpKj0oz7EOC3hNPobRjnpHZPlsMaR7pRqyzYUIJ3O2KCQ6Tw7Dg==";*/
        System.out.println(EncriptionKit.passwordDecrypt(DEV_PUBLIC_KEY, pwds));

    }
}
